package com.suitsoft.ut.service.base;

import java.util.Date;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;

import com.suitsoft.ut.commons.UserHolder;
import com.suitsoft.ut.dao.base.TeacherDao;
import com.suitsoft.ut.entity.account.User;
import com.suitsoft.ut.entity.base.Teacher;

/**
 * 教师管理 服务层类
 *@author Suineg
 */
@Service
@Transactional
public class TeacherManger {
	/** 日志输出对象 */
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	@Autowired
	private TeacherDao teacherDao;
	
	public Teacher get(Long id){
		return teacherDao.get(id);
	}
	
	public void save(Teacher teacher){
		User user = new User();
		user.setId(UserHolder.getLoginUser().getId());
		teacher.setLastUser(user);
		teacher.setLastDate(new Date());
		teacherDao.save(teacher);
	}
	
	public void delete(Long id){
		teacherDao.delete(id);
	}
	
	public List<Teacher> get(List<Long> ids){
		return teacherDao.get(ids);
	}
	
	public Teacher findTeacherByUser(Long id){
		return teacherDao.findByUser(id);
	}
	public Page<Teacher> findThesisByTeacher(Page<Teacher>page ,Long id){
		return teacherDao.findThesisByTeacher(page, id);
	}
	public Teacher findByTeacherNo(String tid){
		return teacherDao.findByTeacherNo(tid);
	}
	
	public void reload(){
		
	}
}

